﻿<UserControl
    x:Class="MDrive.Views.ComView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:Views="clr-namespace:MDrive.Views"
    mc:Ignorable="d"
    d:DesignHeight="300"
    d:DesignWidth="300">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition
                Height="60" />
            <RowDefinition
                Height="60" />
            <RowDefinition
                Height="auto" />
            <RowDefinition
                Height="auto" />
            <RowDefinition
                Height="*" />
        </Grid.RowDefinitions>
        <TextBlock
            HorizontalAlignment="Center"
            VerticalAlignment="Center"
            Text="Commands"
            Foreground="White" />
        <Grid
            Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition
                    Width="2*" />
                <ColumnDefinition
                    Width="*" />
            </Grid.ColumnDefinitions>
            <TextBox
                Text="{Binding ToSend}" />
            <ToggleButton
                Grid.Column="1"
                IsChecked="{Binding SendRequest, Mode=TwoWay}">Send</ToggleButton>
        </Grid>
        <ListBox
            Grid.Row="2"
            FontSize="15"
            SelectedValue="{Binding Port}"
            ItemsSource="{Binding Ports}">
            <ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapPanel
                        IsItemsHost="True"
                        ItemWidth="74" />
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>
        </ListBox>
        <WrapPanel
            Grid.Row="3"
            ItemWidth="74"
            Background="White">
            <CheckBox
                FontSize="15"
                IsChecked="{Binding AutoPoll}">Poll</CheckBox>
            <CheckBox
                FontSize="15"
                IsChecked="{Binding Busy}">Busy</CheckBox>
            <CheckBox
                FontSize="15"
                IsChecked="{Binding SendingProgram}">TxPgm</CheckBox>
            <CheckBox
                FontSize="15"
                IsChecked="{Binding ReadingProgram}">RxPgm</CheckBox>
        </WrapPanel>
        <ListBox
            Grid.Row="4"
            ItemsSource="{Binding History}"
            Views:ListBoxExtenders.AutoScrollToEnd="True"/>
    </Grid>
</UserControl>
